home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
progs
/
editor
/
frexxed
/
fpl
/
faceedit.fpl
< prev
next >
Wrap
Text File
|
1996-07-20
|
4KB
|
122 lines
string FaceFile = "FrexxEd:Startup/MyFace.FPL";
void export FaceEdit()
{
string array[1];
string name;
int number;
number=GetList("facestyle", &array);
if(number) {
string style;
int fg, bg;
int ret;
string n_style;
int n_fg, n_bg;
string s_temp;
int i_temp;
// Request(sprintf("%d faces", number));
while(RequestWindow("Defined face styles:",
"Style:", "a", &array, &name, number)) {
if(0>FaceRead(name, &style, &fg, &bg)) {
Request("Unknown style: " + name, "beep", "ok");
continue;
}
n_style = style;
n_fg = fg;
n_bg = bg;
do {
ret = Request(sprintf("%s = '%s' fg: %d bg: %d", name, n_style, n_fg, n_bg),
"Edit style", "Ok|style|fg|bg|Cancel");
switch(ret) {
case 0: /* leave original */
n_style = style;
n_fg = fg;
n_bg = bg;
break;
case 1: /* use this */
break;
case 2: /* style */
s_temp = PromptString(n_style, "Style",
"Enter style as in\n"
"Bold|Normal|Italic|Underline|Reverse\n"
"with the parts you prefer");
if(strlen(s_temp) || !GetErrNo())
n_style = s_temp;
break;
case 3: /* fg */
i_temp = PromptInt("Forground pen", n_fg,
"Enter pen number to use\n"
"for forground");
if(i_temp || !GetErrNo())
n_fg = i_temp;
break;
case 4: /* bg */
i_temp = PromptInt("Background pen", n_bg,
"Enter pen number to use\n"
"for background");
if(i_temp || !GetErrNo())
n_bg = i_temp;
break;
}
FaceStyle(name, n_style, n_fg, n_bg, 1);
RedrawScreen();
} while(ret>1);
}
if(ret=Request("Would you like to save this now?", "Save Styles", "yes|help|no")) {
string store;
if(2 == ret) {
ret=Request("You will now be asked to enter a\n"
"file name to use to store your styles.\n"
"By default, and suggested, is a file that\n"
"will be put in your FrexxEd:Startup/ drawer\n"
"since that will be 'executed' each time you\n"
"will start FrexxEd in the future!\n"
"Continue?");
}
if(ret) {
store = PromptFile(FaceFile, "Save Styles", "#?.FPL", "s");
if(strlen(store)) {
int newid;
int ourid;
int n;
string str;
FaceFile = store; /* remember to next time */
newid = New();
ourid=CurrentBuffer(newid);
Output("/* Generated by FaceEdit.FPL v0.1 " + GetDate(-1) + " */\n");
for(;n< number; n++) {
FaceRead(array[n], &style, &fg, &bg);
str = sprintf("FaceStyle(\"%s\", \"%s\", %d, %d, 1);\n",
array[n], style, fg, bg);
Output(str);
}
Save(store);
CurrentBuffer(ourid);
Kill(newid);
}
}
}
}
else
Request("none");
}
ReadInfo("_faceedit");
if(GetErrNo()) { /* just a way to make the menu only once, even if this file
is executed repeatedly! */
/*
* Create our menu setup:
*/
MenuAdd("s", "Face Styles...", "FaceEdit();", "",
ReadInfo("menu_program_title"),
ReadInfo("menu_program_item"),-1); // Add to PackageSettings
MenuBuild();
ConstructInfo("_faceedit", "", "", "BGH", "", 0, 1, 1);
}